package ae.pcfc.etks.online.common.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * ServiceReq entity. @author Mohtisham.Salahria
 */
@Entity
@Table(name = "T_ETKS_SERVICE_REQ", schema = "ETKS_ONLINE_DBA")
@SequenceGenerator(name="SQ_ETKS_SERVICE_REQ", sequenceName = "SQ_ETKS_SERVICE_REQ", initialValue = 1, allocationSize = 1)
public class ServiceReq implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Long serviceReqId;
	private String serviceNameEng;
	private String serviceNameArb;	
	private Service Service;
	private User User;
	private String applicationId;
	private Set<ServiceAttrValReq> ServiceAttrValReqs = new HashSet<ServiceAttrValReq>(
			0);
	// Constructors

	/** default constructor */
	public ServiceReq() {
	}

	/** full constructor */
	public ServiceReq(Service Service, User User,
			String applicationId) {
		this.Service = Service;
		this.User = User;
		this.applicationId = applicationId;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SQ_ETKS_SERVICE_REQ")
	@Column(name = "SERVICE_REQ_ID", unique = true, nullable = false, precision = 11, scale = 0)
	public Long getServiceReqId() {
		return this.serviceReqId;
	}

	public void setServiceReqId(Long serviceReqId) {
		this.serviceReqId = serviceReqId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SERVICE_ID")
	public Service getService() {
		return this.Service;
	}

	public void setService(Service Service) {
		this.Service = Service;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USER_ID")
	public User getUser() {
		return this.User;
	}

	public void setUser(User User) {
		this.User = User;
	}

	@Column(name = "APPLICATION_ID", length = 2000)
	public String getApplicationId() {
		return this.applicationId;
	}

	public void setApplicationId(String applicationId) {
		this.applicationId = applicationId;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "serviceReq")
	public Set<ServiceAttrValReq> getServiceAttrValReqs() {
		return ServiceAttrValReqs;
	}
	
	public void setServiceAttrValReqs(Set<ServiceAttrValReq> serviceAttrValReqs) {
		ServiceAttrValReqs = serviceAttrValReqs;
	}
	
	@Column(name = "SERVICE_NAME_ENG", nullable = false, length = 50)
	public String getServiceNameEng() {
		return serviceNameEng;
	}

	public void setServiceNameEng(String serviceNameEng) {
		this.serviceNameEng = serviceNameEng;
	}

	@Column(name = "SERVICE_NAME_ARB", nullable = false, length = 50)
	public String getServiceNameArb() {
		return serviceNameArb;
	}

	public void setServiceNameArb(String serviceNameArb) {
		this.serviceNameArb = serviceNameArb;
	}
	
}